import React, { Component } from 'react'
import store from '../HMstore'
import {sendAction} from '../HMactions'
export default class HMRedux extends Component {
    handleClick = ()=>{
        const action = sendAction()
        store.dispatch(action)
    };
    componentDidMount(){
        store.subscribe(()=>{
            console.log('subscribe:',store.getState());
            this.setState({})
        })
    }
    render() {
        return (
            <div>
                <button onClick={this.handleClick}>点击发送一个action</button>
                <div>{store.getState().value}</div>
            </div>
        )
    }
}
